<template>
  <div class="query">
    <div class="title-wrap">
      <!-- <img src="@/assets/images/xiaoLOGO.png" /> -->
    </div>
    <div class="card">
      <div class="item">
        <div class="left" style="padding-top: 25px">{{ searchData.oldAddress }}</div>
        <div class="middle">
          <span class="type" v-if="searchData.transport === 'empty'">空运</span>
          <span class="type" v-if="searchData.transport === 'sea'">海运</span>
          <span class="type" v-if="searchData.transport === 'road'">陆运</span>
          <span class="type" v-if="searchData.transport === 'iron'">铁运</span>
          <span class="line"></span>
        </div>
        <div class="right" style="padding-top: 25px">{{ searchData.destination }}</div>
      </div>
      <div class="item">
        <div class="left">货物名称: {{ searchData.goodsName }}</div>
        <div class="right">大小: {{ searchData.long }}cm*{{ searchData.wide }}cm*{{ searchData.high }}cm</div>
      </div>
      <div class="item">
        <div class="left">重量: {{ searchData.weight }} kg</div>
        <div class="right"></div>
      </div>
      <div class="item infor">
        <div class="left">{{ demand.info1 }}</div>
        <div class="right" @click="goDetail(demand.info1)">查看</div>
      </div>
      <div class="item infor">
        <div class="left">{{ demand.info2 }}</div>
        <div class="right" @click="goDetail(demand.info2)">查看</div>
      </div>
      <div class="item infor">
        <div class="left">{{ demand.info3 }}</div>
        <div class="right" @click="goDetail(demand.info3)">查看</div>
      </div>
    </div>
    <van-tabs v-model="active" color="#1989fa" swipeable>
      <van-tab title="全部">
        <div class="board" v-for="(item,index) in infoData" :key="index">
          <div class="board-title">
            <img src="@/assets/images/huowu.png" />
            {{item.transport_name}}
          </div>
          <div class="board-content">
            <div class="content-price">{{Number(item.total_freight).toFixed(2)}}</div>
            <div class="content-desc">总运费</div>
          </div>
          <div class="board-cell grey">
            参考运费
            <div class="cell-content">{{Number(item.consult_freight).toFixed(2)}}</div>
          </div>
          <div class="board-cell">
            燃油费
            <div class="cell-content">{{Number(item.fuel_cost).toFixed(2)}}</div>
          </div>
          <div class="board-cell grey">
            其他费用
            <div class="cell-content">{{Number(item.other_cost).toFixed(2)}}</div>
          </div>
          <div class="board-cell">
            货运方式
            <div class="cell-content">{{item.transport_way}}</div>
          </div>
          <div class="board-cell grey">
            参考时效
            <div class="cell-content">{{item.consult_aging ? item.consult_aging + '个工作日' : '无'}}</div>
          </div>
          <!-- <div class="board-desc">提示：支持包油包税到门，可接普通商业地址，私人住宅地址加收30元/件</div> -->
          <div class="board-desc">提示：其他费用为产品附加费，附加费仅供参考</div>
        </div>
      </van-tab>
      <van-tab title="经济类">
        <div class="board" v-for="(item,index) in infoData1" :key="index">
          <div class="board-title">
            <img src="@/assets/images/huowu.png" />
            {{item.transport_name}}
          </div>
          <div class="board-content">
            <div class="content-price">{{Number(item.total_freight).toFixed(2)}}</div>
            <div class="content-desc">总运费</div>
          </div>
          <div class="board-cell grey">
            参考运费
            <div class="cell-content">{{Number(item.consult_freight).toFixed(2)}}</div>
          </div>
          <div class="board-cell">
            燃油费
            <div class="cell-content">{{Number(item.fuel_cost).toFixed(2)}}</div>
          </div>
          <div class="board-cell grey">
            其他费用
            <div class="cell-content">{{Number(item.other_cost).toFixed(2)}}</div>
          </div>
          <div class="board-cell">
            货运方式
            <div class="cell-content">{{item.transport_way}}</div>
          </div>
          <div class="board-cell grey">
            参考时效
            <div class="cell-content">{{item.consult_aging ? item.consult_aging + '个工作日' : '无'}}</div>
          </div>
          <!-- <div class="board-desc">提示：支持包油包税到门，可接普通商业地址，私人住宅地址加收30元/件</div> -->
          <div class="board-desc">提示：其他费用为产品附加费，附加费仅供参考</div>
        </div>
      </van-tab>
      <van-tab title="标快类">
        <div class="board" v-for="(item,index) in infoData2" :key="index">
          <div class="board-title">
            <img src="@/assets/images/huowu.png" />
            {{item.transport_name}}
          </div>
          <div class="board-content">
            <div class="content-price">{{Number(item.total_freight).toFixed(2)}}</div>
            <div class="content-desc">总运费</div>
          </div>
          <div class="board-cell grey">
            参考运费
            <div class="cell-content">{{Number(item.consult_freight).toFixed(2)}}</div>
          </div>
          <div class="board-cell">
            燃油费
            <div class="cell-content">{{Number(item.fuel_cost).toFixed(2)}}</div>
          </div>
          <div class="board-cell grey">
            其他费用
            <div class="cell-content">{{Number(item.other_cost).toFixed(2)}}</div>
          </div>
          <div class="board-cell">
            货运方式
            <div class="cell-content">{{item.transport_way}}</div>
          </div>
          <div class="board-cell grey">
            参考时效
            <div class="cell-content">{{item.consult_aging ? item.consult_aging + '个工作日' : '无'}}</div>
          </div>
          <!-- <div class="board-desc">提示：支持包油包税到门，可接普通商业地址，私人住宅地址加收30元/件</div> -->
          <div class="board-desc">提示：其他费用为产品附加费，附加费仅供参考</div>
        </div>
      </van-tab>
      <van-tab title="商业快递">
        <div class="board" v-for="(item,index) in infoData3" :key="index">
          <div class="board-title">
            <img src="@/assets/images/huowu.png" />
            {{item.transport_name}}
          </div>
          <div class="board-content">
            <div class="content-price">{{Number(item.total_freight).toFixed(2)}}</div>
            <div class="content-desc">总运费</div>
          </div>
          <div class="board-cell grey">
            参考运费
            <div class="cell-content">{{Number(item.consult_freight).toFixed(2)}}</div>
          </div>
          <div class="board-cell">
            燃油费
            <div class="cell-content">{{Number(item.fuel_cost).toFixed(2)}}</div>
          </div>
          <div class="board-cell grey">
            其他费用
            <div class="cell-content">{{Number(item.other_cost).toFixed(2)}}</div>
          </div>
          <div class="board-cell">
            货运方式
            <div class="cell-content">{{item.transport_way}}</div>
          </div>
          <div class="board-cell grey">
            参考时效
            <div class="cell-content">{{item.consult_aging ? item.consult_aging + '个工作日' : '无'}}</div>
          </div>
          <!-- <div class="board-desc">提示：支持包油包税到门，可接普通商业地址，私人住宅地址加收30元/件</div> -->
          <div class="board-desc">提示：其他费用为产品附加费，附加费仅供参考</div>
        </div>
      </van-tab>
    </van-tabs>
    <!-- <div class="board" v-if="infoData.ageing">
        <div class="board-title">
          <img src="@/assets/images/huowu.png" />{{infoData.ageing.transport_name}}
        </div>
        <div class="board-content">
          <div class="content-price">{{Number(infoData.ageing.total_freight).toFixed(2)}}</div>
          <div class="content-desc">总运费</div>
        </div>
        <div class="board-cell grey">
          参考运费
          <div class="cell-content">{{Number(infoData.ageing.consult_freight).toFixed(2)}}</div>
        </div>
        <div class="board-cell">
          燃油费
          <div class="cell-content">{{Number(infoData.ageing.fuel_cost).toFixed(2)}}</div>
        </div>
        <div class="board-cell grey">
          其他费用
          <div class="cell-content">{{Number(infoData.ageing.other_cost).toFixed(2)}}</div>
        </div>
        <div class="board-cell">
          货运方式
          <div class="cell-content">{{infoData.ageing.transport_way}}</div>
        </div>
        <div class="board-cell grey">
          参考时效
          <div class="cell-content">{{infoData.ageing.consult_aging}}天</div>
        </div>
        <div class="board-desc">提示：其他费用为产品附加费，附加费仅供参考</div>
    </div>-->
  </div>
</template>

<script>
export default {
  data() {
    return {
      searchData: "",
      active: 0,
      demand: {
        info1: "对应海关要求",
        info2: "发货提供单证要求",
        info3: "禁限寄要求"
      },
      infoData: [], //全部
      infoData1: [], //经济类
      infoData2: [], //标快类
      infoData3: [] //商业快递
    };
  },
  created() {
    this.infoData = JSON.parse(sessionStorage.getItem("result"));
    this.searchData = JSON.parse(sessionStorage.getItem("message"));
    this.filterData();
  },
  methods: {
    filterData() {
      this.infoData1 = this.infoData.filter(item => {
        return item.type === "0";
      });
      this.infoData2 = this.infoData.filter(item => {
        return item.type === "1";
      });
      this.infoData3 = this.infoData.filter(item => {
        return item.type === "2";
      });
    },
    goDetail(info) {
      this.$router.push({
        path: "./info",
        query: {
          title: info
        }
      });
    }
  }
  // destroyed() {
  //   sessionStorage.removeItem("result");
  // }
};
</script>

<style scoped>
.query {
  background: #ffffff;
  height: 100vh;
}
.title-wrap {
  display: flex;
  align-items: center;
  padding: 60px 32px 40px;
  font-size: 50px;
  font-weight: bold;
  background: #fff;
}
.title-wrap img {
  width: 203px;
  height: 60px;
  margin-right: 30px;
}
.card {
  padding: 0 40px 30px;
  font-size: 24px;
}

.card .item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card .infor .right {
  color: #1989fa;
}
.card .item .middle {
  flex: 1;
}

.card .item .middle span {
  display: block;
  text-align: center;
  width: 100%;
}
.card .item .middle .line {
  width: 80%;
  height: 20px;
  margin: 0 auto;
  background-color: #1989fa;
}

.board {
  background: rgba(255, 255, 255, 1);
  border-radius: 16px;
  border: 1px solid rgba(227, 232, 237, 1);
  padding: 28px 10px;
  margin: 30px 32px;
}
.board-title {
  padding: 28px 10px;
  font-size: 38px;
  font-weight: bold;
  border-bottom: 1px solid #eee;
}
.board-title img {
  width: 29px;
  height: 29px;
  margin-right: 14px;
}
.board-content {
  padding: 48px 0;
  text-align: center;
  font-size: 28px;
}
.content-price {
  font-size: 52px;
  font-weight: bold;
  color: rgba(250, 109, 41, 1);
  margin-bottom: 10px;
}
.board-cell {
  display: flex;
  align-items: center;
  padding: 30px 32px;
  font-size: 28px;
}
.cell-content {
  flex: 1;
  text-align: right;
  color: #82909f;
  font-weight: bold;
}
.board-desc {
  padding: 30px 32px;
  color: #82909f;
  font-size: 24px;
}
.grey {
  background: #fafafa;
}
</style>
